package org.example.db.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.example.db.entity.Role;
import org.example.db.entity.UserRole;

import java.util.List;

public interface UserRoleMapper extends BaseMapper<UserRole> {

    @Select("select role.id, role.name, description, role.add_time, role.update_time from user_role " +
            "inner join role on role.id = user_role.role_id " +
            "where user_id = #{userId}")
    List<Role> getRolesByUserId(Long userId);

}
